﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DCTEDU_/HeThongMaster.master" AutoEventWireup="true"
    CodeBehind="QLTaiSan.aspx.cs" Inherits="QuanLyThietBi.DCTEDU_.QuanTri.QLTaiSan" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<%@ Register Assembly="PagerControl" Namespace="CutePager" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Quản lý Tài sản Thiết bị</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="upPanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:HiddenField runat="server" ID="H_PhongHocId" Value="0" />
            <div class="row">
                <div class="col-sm-6">
                    <section class="panel">
                        <header class="panel-heading">
                            Danh sách Phòng học
                            <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                             </span>
                        </header>
                        <div class="panel-body">
                            <div class="alert alert-danger clearfix">
                <span class="alert-icon"><i class="fa fa-envelope-o"></i></span>
                <div class="notification-info">
                    <ul class="clearfix notification-meta">
  
                    </ul>
                    <p>
                        1. Để xem được các thiết bị trong phòng máy tính, nhấn vào tên phòng máy tính tương ứng để xem; <br/>
                        2. Để thêm thiết bị mới -> Nhấn tên phòng -> Nhấn Thêm mới(thủ công); Nhấn Import Excel(tự động);<br/>
                        3. Thao tác từng bước 1 để hệ thống tự động xử lý và in ra kết quả tương ứng.
                    </p>
                </div>
            </div>
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Tên phòng</th>
                                    <th>Cán bộ quản lý</th>
                                </tr>
                                </thead>
                                <tbody>
                                <asp:Repeater runat="server" ID="rpPhongHoc" OnItemCommand="rpPhongHoc_ItemCommand"><ItemTemplate>  
                                
                                <tr>
                                    <td><%# Container.ItemIndex + 1%></td>
                                    <td><asp:LinkButton runat="server" ID="cmdSelect" CommandName="Select" CommandArgument='<%# Eval("MaPhong") %>' ><%# Eval("TenPhong") %></asp:LinkButton></td>
                                    <td><%# getTenCanBo(Eval("MaCanBo")) %></td>
                                </tr>      
                                
                                </ItemTemplate></asp:Repeater> 
                                </tbody>
                            </table>
                        </div>

                    </section>
                </div>
                <asp:Panel class="col-sm-6" runat="server" ID="pnDSThietBi" Visible="False">
                    <section class="panel">
                        <header class="panel-heading">
                            Trang thiết bị phòng máy<asp:Literal runat="server" ID="litPhong"></asp:Literal>
                            <span class="tools pull-right">
                                <a href="javascript:;" class="fa fa-chevron-down"></a>
                             </span>
                        </header>
                        <div class="panel-body" style=" /*   position: relative;
    overflow-y: scroll;
    height: 477px;*/">  
                          <asp:Button ID="cmdLuu" runat="server" 
                 Style="float: right; position: relative; bottom: 5px;margin-left: 5px;"
                OnClick="cmdAdd_OnClick" Text="Thêm mới" CausesValidation="False" CssClass="btn btn-primary btn-image-create" />  
                <asp:Button ID="cmdImport" runat="server" CausesValidation="False" Style="float: right; position: relative; bottom: 5px; margin-left: 5px;"
                OnClick="cmdImport_OnClick" Text="Import từ Excel" CssClass="btn btn-primary btn-image-report" />
               
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>#</th>  
                                    <th>Tác vụ</th>
                                    <th>Tên thiết bị</th>
                                    <th>Ngày sử dụng</th>
                                    <th>Tình trạng</th>
                                </tr>
                                </thead>
                                <tbody>
                                <asp:Repeater runat="server" ID="rpThietBi" OnItemCommand="rpThietBi_OnItemCommand">
                                    <ItemTemplate>
                                <tr>
                                    <td><%# Container.ItemIndex + 1%></td> 
                                    <td><asp:ImageButton runat="server" ID="cmdDelete" CommandName="Delete" CommandArgument='<%# Eval("MaThietBi") %>' ImageUrl="~/Images/DeleteRed.png" ToolTip="Click để xóa" ></asp:ImageButton></td>
                                    <td><%# Eval("TenThietBi") %></td>
                                    <td><%# Convert.ToDateTime(Eval("NgaySuDung")).ToString("dd/MM/yyyy") %></td>
                                    <td><%# (Eval("TrangThai").ToString())=="True" ? "<html><img src=../../Images/checkk.png /></html>" : "<html><img src=../../Images/redx.png /></html>"%></td>
                                </tr>
                               </ItemTemplate>
                                </asp:Repeater>   
              <cc1:Pager ID="Pager1" runat="server" PreviousClause="Lùi" NextClause="Tiến" LastClause=""
                                    FirstClause="" PageClause="Trang " OfClause=" /" PageSize="8" OnCommand="Pager1_Command"
                                    ForeColor="#006600" Font-Bold="True" />
                                </tbody>
                            </table>
                        </div>
                    </section>
                </asp:Panel>
            </div>
            <div class="row">
                <asp:Panel class="col-sm-12" runat="server" ID="pmImportThietBi" Visible="False">
                    <section class="panel">
                    <header class="panel-heading">
                        Thêm thiết bị cho <asp:Literal runat="server" ID="litPhong3"></asp:Literal>
                        <span class="tools pull-right">
                            <a href="javascript:;" class="fa fa-chevron-down"></a>
                         </span>
                    </header> 
                     <div class="panel-body">
                        <div class="adv-table editable-table ">
                            <div class="clearfix">
                                <div class="btn-group">       
                                <asp:Literal ID="lblFileDinhKem" runat="server" Text=""></asp:Literal>
  <asp:FileUpload ID="FileUpload1" runat="server" style="padding: 6px 12px; display: inline" />  
<asp:Button runat="server" CssClass="btn btn-primary" ID="cmdUpload" CausesValidation="false" 
 Text="Import" OnClick="btnUpload_Click"/> 
 <asp:GridView ID="gvExcelFile" runat="server" Visible="False" CellPadding="4" ForeColor="#333333" GridLines="Horizontal">  
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />  
            <EditRowStyle BackColor="#999999" />  
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />  
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />  
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />  
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />  
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />  
        </asp:GridView> 
</section>
            </div>
            </div> </div> </div> </asp:Panel>
            <asp:Panel class="col-sm-12" runat="server" ID="pnThemThietBi" Visible="False">
                <section class="panel">
                    <header class="panel-heading">
                        Thêm thiết bị cho <asp:Literal runat="server" ID="litPhong2"></asp:Literal>
                        <span class="tools pull-right">
                            <a href="javascript:;" class="fa fa-chevron-down"></a>
                         </span>
                    </header>

                 <div class="panel-body">
                        <div class="adv-table editable-table ">
                            <div class="clearfix">
                                <div class="btn-group">  
                                <asp:LinkButton runat="server" ID="cmdSave" OnClick="cmdSave_OnClick" CssClass="btn btn-primary">
                                  
                                        <i class="fa fa-save"></i>&nbsp;Thêm thiết bị 
                                  </asp:LinkButton>
                                </div>
             
                            </div>
                           
                        </div> 
                     <%--   <div class="row">   --%>
                            <table class="table table-striped">
                                <thead>
                                <tr>     
                                <th>#</th>
                                    <th>Tên thiết bị</th>    
                                    <th>Vị trí</th>
                                    <th>Ngày sử dụng</th>
                                    <%--<th>Tình trạng</th>--%>    
                                    <th>Thực hiện</th>
                                </tr>
                                </thead>
                                <tbody>
                        <asp:Repeater runat="server" ID="rpDanhSachThietBi" 
                        OnItemCommand="rpDanhSachThietBi_ItemCommand" OnItemDataBound="rpDanhSachThietBi_ItemDataBound">
                            <ItemTemplate> 
                         <tr>  
                        <th><%# Container.ItemIndex+1%></th>
                          <th><asp:TextBox runat="server" ID="txtTenThietBi" Text='<%# DataBinder.Eval(Container.DataItem, "TenThietBi") %>' CssClass="form-control "></asp:TextBox></th>   
                          <th><asp:TextBox runat="server" ID="txtViTri" Text='<%# DataBinder.Eval(Container.DataItem, "ViTri") %>' CssClass="form-control "></asp:TextBox></th>
                          <th><asp:TextBox runat="server" ID="txtNgaySuDung" placeholder="dd/MM/yyyy" Text='<%# DataBinder.Eval(Container.DataItem, "NgaySuDung") %>' CssClass="form-control "></asp:TextBox>
</th>
                             
                                    <th><asp:Button ID="btnAddAnother" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Button") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "Button") %>' /></th> 
                                     </tr>   
                        </ItemTemplate>
                        </asp:Repeater>
                           </tbody>
                            </table>
                          <%--  <div class="col-xs-6 form-group">
                        <label class="col-sm-6 control-label">Tên thiết bị<span style="color: Red">(*)</span></label>
                        <div class="col-sm-6">
                        <asp:TextBox ID="txtTen" runat="server" CssClass="form-control canh-float-left error" MaxLength="12" minlength="2" ></asp:TextBox>
                     
                        </div>

                    </div>
                      <div class="col-xs-6 form-group">
                        <label class="col-sm-6 control-label">Vị trí<span style="color: Red">(*)</span></label>
                        <div class="col-sm-6">
                        <asp:TextBox ID="txtViTri" runat="server" CssClass="form-control canh-float-left error" MaxLength="12" minlength="2" ></asp:TextBox>
                  
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Chỉ chấp nhận kiểu số"
                        Display="Dynamic" ValidationExpression="\d+" ControlToValidate="txtViTri"></asp:RegularExpressionValidator>


                        </div>

                    </div>  --%>
                       <%-- </div> --%>
                    </div>
                </section>
            </asp:Panel>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="cmdUpload" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:UpdateProgress runat="server" ID="UpdateProgress2" AssociatedUpdatePanelID="upPanel1">
        <ProgressTemplate>
            <div style="top: 20%; right: 50%; transition: all 300ms ease 100ms; color: Black;
                padding: 8px; position: fixed; z-index: 10000">
                <asp:Image runat="server" ID="imgloading" ImageUrl="~/Images/loading.gif" /></div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</asp:Content>
